package com.baizhi.service.service.impl;

import dao.heroDao;
import entity.hero;
import org.apache.ibatis.session.SqlSession;
import com.baizhi.service.heroService;
import util.MyBatisUtils;
import util.PageBean;

import java.util.List;

public class PageService implements heroService {

    @Override
        public PageBean<hero> find(PageBean<hero> p,String perName){
        SqlSession sqlSession = MyBatisUtils.openSession();
        heroDao mapper = sqlSession.getMapper(heroDao.class);
        List<hero> list = mapper.findList(p.getStart(), p.getEnd(),perName);
        int i = mapper.countHero(perName);
        p.setCount(i);
        p.setList(list);
        return p;
    }
}
